import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { BedInfoVO, BedInfoForm, BedInfoQuery } from '@/api/nursing/bedInfo/types';

/**
 * 查询床位管理列表
 * @param query
 * @returns {*}
 */

export const listBedInfo = (query?: BedInfoQuery): AxiosPromise<BedInfoVO[]> => {
  return request({
    url: '/nursing/bedInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询床位管理详细
 * @param bedId
 */
export const getBedInfo = (bedId: string | number): AxiosPromise<BedInfoVO> => {
  return request({
    url: '/nursing/bedInfo/' + bedId,
    method: 'get'
  });
};

/**
 * 新增床位管理
 * @param data
 */
export const addBedInfo = (data: BedInfoForm) => {
  return request({
    url: '/nursing/bedInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改床位管理
 * @param data
 */
export const updateBedInfo = (data: BedInfoForm) => {
  return request({
    url: '/nursing/bedInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除床位管理
 * @param bedId
 */
export const delBedInfo = (bedId: string | number | Array<string | number>) => {
  return request({
    url: '/nursing/bedInfo/' + bedId,
    method: 'delete'
  });
};
